const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    proxy: {
      "/security": {
        //此处要与 /services/api.js 中的 API_PROXY_PREFIX 值保持一致
        target: process.env.VUE_APP_URL, //配置要替换的后台接口地址
        changeOrigin: true, //配置允许改变origin
        ws: true, //proxy websockets
        pathRewrite: {
          "^/security": "/security",
          //pathRewrite: {'^/api': '/'}    重写之后url为 http://localhost：8080/xxxx
          //pathRewrite: {'^/api': '/api'} 重写之后url为 http://localhost：8080/api/xxxx
        },
      },
      '/api': {
        target: 'https://geo.datav.aliyun.com/',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/'
        }
      },
      '/geoserver': {
        target:process.env.VUE_APP_URL + "/geoserver",
        changeOrigin: true,
        pathRewrite: {
          '^/geoserver': '/'
        }
      },
      '/geowebcache': {
        target: 'https://zyjc.lyj.gd.gov.cn/',
        changeOrigin: true,
        pathRewrite: {
          '^/geowebcache': '/'
        }
      }
    }
  }
})
